<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>OnlineJudge</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <h1>OnlineJudge</h1>
    <p>Enter your JSON format text below and click submit</p>
    <form id="myForm">
      <label for="jsonInput">Input:</label>
      <textarea id="jsonInput" class="input_textarea" ></textarea>
      <br /><br />
      <button type="button" onclick="submitForm()">Submit</button>
    </form>
    <br />
    <label for="result">result:</label>
    <div id="result"></div>
    <script>
      function submitForm() {
        var xhr = new XMLHttpRequest();
        xhr.onreadystatechange = function() {
          if (this.readyState == 4 && this.status == 200) {
            document.getElementById("result").innerHTML = this.responseText;
          }
        };
        xhr.open("POST", "http://hynmpy.top:8081/producer/judge.do", true);
        xhr.setRequestHeader("Content-type", "application/json");
        xhr.send(document.getElementById("jsonInput").value);
      }
    </script>
  </body>
</html>
